package com.business.actions;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.business.service.BusinessService;
import com.dong.web.Redirect;
import com.dong.web.annotation.Action;
import com.dong.web.annotation.Auto;
import com.dong.web.annotation.ContentType;
import com.dong.web.annotation.Json;
import com.dong.web.annotation.Path;
import com.dong.web.annotation.WriterContent;
import com.dong.web.tool.AForm;
import com.dong.web.tool.AMap;
import com.dong.web.tool.MultiForm;

@Action("business.action")
public class BusinessAction {

	@Auto
	private BusinessService service;

	@Path("index")
	public String index() {
		return "/main.jsp";
	}

	@Path("add")
	@Json
	public String add(AForm<String, Object> aform, AMap<String, Object> amap) {
		System.out.println(aform);
		boolean bool = service.add();
		return "{\"message\":\"" + bool + "\"}";
	}

	@Path("A")
	public String A(AMap<String, Object> amap) {
		amap.addAttribute("list", new ArrayList<Object>());
		return "a.jsp";
	}

	@Path("B")
	public Redirect B() {
		return new Redirect("business.action?method=C&key=value");
	}

	@Path("uploadZip")
	@WriterContent
	@ContentType("text/html")
	public String uploadZip(HttpServletRequest req, HttpServletResponse res,
			MultiForm form, AMap<String, Object> amap) {
		return "<script>alert('信息上传成功');</script>";
	}

}
